<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>思途CMS{$coreVersion}</title>
    {template 'stourtravel/public/public_min_js'}
    {php echo Common::getCss('style.css,base.css,base_new.css'); }
    {php echo Common::getScript("jquery.validate.js,jquery.validate.addcheck.js"); }
    <style>
        .info-item-block{
            padding: 0;
        }
        .info-item-block>li .item-hd{
            width: 60px;
        }
        .info-item-block>li .item-bd{
            padding-left: 65px;
        }
    </style>
</head>
<body style="width: 320px; height: 243px; overflow: hidden">

<form id="frm" name="frm">
    <ul class="info-item-block">
        <li class="list_dl">
            <span class="item-hd">手机号{Common::get_help_icon('chang_fxcode')}：</span>
            <div class="item-bd" >
                <input type="text" class="input-text w200"   id="mobile" value="" placeholder="分销商手机号">
                <a href="javascript:;" class=" btn btn-primary radius size-S mt-3" id="keyword"  title="选择">查询</a>
            </div>
        </li>
        <li class="list_dl">
            <span class="item-hd">分销商：</span>
            <div class="item-bd">
                <span class="item-text" id="fenxiao_name">暂无</span>
            </div>
        </li>
    </ul>
    <div class="clearfix mt-15 text-c">
        <a class="btn btn-primary radius" id="btn_save" href="javascript:;">确认</a>
        <input type="hidden" id="ids"  value="{$ids}">
<!--        新分销商id-->
        <input type="hidden" id="fid"  value="">
        <input type="hidden" id="mid"  value="{$mid}">
    </div>
</form>

<script language="JavaScript">

    $(function(){
        $('#keyword').click(function(){
            var url=SITEURL+'fenxiao/admin/fenxiao/ajax_search_fenxiao';
            $.ajax({
                type:'POST',
                url:url,
                data:{
                    mobile:$('#mobile').val()
                },
                success:function(resp){
                    resp = JSON.parse(resp);
                    if(resp.status){
                        $('#fenxiao_name').text(resp.data)
                        $('#fid').val(resp.fid)
                    }else{
                        $('#fenxiao_name').text(resp.msg)
                        $('#fid').val('')
                        ST.Util.showMsg(resp.msg,5);
                    }
                }
            })
        })

        $('#btn_save').click(function(){
            $.ajax({
                type:'POST',
                url:SITEURL+'fenxiao/admin/fenxiao/ajax_change_fxcode',
                data:{
                    fid:$('#fid').val(),
                    ids:$('#ids').val(),
                    mid:$('#mid').val(),
                },
                success:function(resp){
                    resp = JSON.parse(resp);
                    if(resp.status){
                        ST.Util.showMsg(resp.msg,4);
                        setTimeout(function (){
                            ST.Util.responseDialog({},true);
                        },1000)
                    }else{
                        ST.Util.showMsg(resp.msg,5);
                    }
                }
            })
        })

    })


</script>

</body>
</html>